namespace Ds.DataBase.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class MoBan : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.MoBans",
                c => new
                    {
                        mbid = c.Int(nullable: false, identity: true),
                        mbmc = c.String(),
                        mbtype = c.Int(nullable: false),
                        cjsj = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.mbid);
            
            CreateTable(
                "dbo.MoBanZhiWeis",
                c => new
                    {
                        MoBan_mbid = c.Int(nullable: false),
                        ZhiWei_zwid = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.MoBan_mbid, t.ZhiWei_zwid })
                .ForeignKey("dbo.MoBans", t => t.MoBan_mbid, cascadeDelete: true)
                .ForeignKey("dbo.ZhiWeis", t => t.ZhiWei_zwid, cascadeDelete: true)
                .Index(t => t.MoBan_mbid)
                .Index(t => t.ZhiWei_zwid);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.MoBanZhiWeis", "ZhiWei_zwid", "dbo.ZhiWeis");
            DropForeignKey("dbo.MoBanZhiWeis", "MoBan_mbid", "dbo.MoBans");
            DropIndex("dbo.MoBanZhiWeis", new[] { "ZhiWei_zwid" });
            DropIndex("dbo.MoBanZhiWeis", new[] { "MoBan_mbid" });
            DropTable("dbo.MoBanZhiWeis");
            DropTable("dbo.MoBans");
        }
    }
}
